class Solution {
    public:
        int divisorSubstrings(int num, int k) {
            int s = 0;
            int ret = 0;
            int t = 1;
            for(int i = 1;i <k;i++) t*= 10;
            for(long long tmp = 1; tmp <= num;tmp *= 10)
            {
                s/= 10;
                s += num / tmp % 10 *t;
                if(tmp>= t && s != 0 && num%s == 0)
                    ret++;
            }
            return ret;
        }
    };